14. Video: LEFT and RIGHT JOINs

Notice

There are two videos in this concept:

  1. The first shows JOINs the way you have currently been working with data.
  2. The second shows LEFT and RIGHT JOIN statements.

JOINs

Errata: In the above video, there is an error in the SQL included - the final line should include the table aliases, so they final line would be ON o.account_id = a.id;.

Above you learned about the JOINs you have been writing so far - that is an INNER JOIN. In the video below, you will learn about other ways that we might want to JOIN our data depending on the question we are asking.


Other JOINs

JOINs

Notice each of these new JOIN statements pulls all the same rows as an INNER JOIN, which you saw by just using JOIN, but they also potentially pull some additional rows.

If there is not matching information in the JOINed table, then you will have columns with empty cells. These empty cells introduce a new data type called NULL. You will learn about NULLs in detail in the next lesson, but for now you have a quick introduction as you can consider any cell without data as NULL.